﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;

public partial class src_admin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Utility.checkLogin();
    }

    protected void BInserici_Click(object sender, EventArgs e)
    {
        string nome = TBCat.Text;

        static void InserisciCategoria()
    {
     try
    {
         SqlConnection conn = new SqlConnection();
            WebConfigurationManager.ConnectionStrings["ForumDB"].ToString();
        {
            conn.Open();
            using (SqlCommand cmd =
                new SqlCommand("INSERT INTO Category VALUES(" +
                    "@name, @creator)", conn))
            {
                cmd.Parameters.AddWithValue("@name", nome);
                cmd.Parameters.AddWithValue("@creator", "Murat");
                

                int rows = cmd.ExecuteNonQuery();

             
            }
        }
    }
    catch (SqlException ex)
    {
        //Log exception
        //Display Error message
    }
   }

    }




    
